<?php
/**
 * User: b179a9
 * Date: 9/26/11
 * Time: 6:06 PM
 */

class App_Form_News_Form extends Zend_Form
{
    function init()
    {

        $this->setMethod('post');
        $this->setAction('');
        $this->setAttrib('enctype', 'multipart/form-data');

        $id = new Zend_Form_Element_Hidden('id');
        $this->addElement($id);

        $title = new Zend_Form_Element_Text('title');
        $title->setLabel('Title:')
                ->setRequired()
                ->addValidators(array(new Zend_Validate_StringLength(1, 64)));
        $this->addElement($title);

        $content = new Zend_Form_Element_Textarea('content');
        $content->setLabel('Content:')
                ->setRequired();
        $this->addElement($content);

        $public = new Zend_Form_Element_Checkbox('public');
        $public->setLabel('Public:');
        $this->addElement($public);

        $img = new Zend_Form_Element_File('img');
        $img->setLabel('Image:')
            ->setDestination(dirname(APPLICATION_PATH) . '/public/images/news/');
        $this->addElement($img);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Save');

        $this->addElement($submit);

    }
}
